home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / Media / bumpshader2.vsh < prev    next >
Encoding:
Text File  |  2001-10-08  |  748 b   |  52 lines

  1. vs.1.0
  2.  
  3. ;Vertex Shader for DX7 class hardware
  4. ;Constants 
  5. ;
  6. ;c0-c3 Object
  7. ;
  8. ;c4-c7 Projection
  9. ;
  10. ;c8-c11 Total matrix
  11. ;
  12. ;c12 - Light Direction (In World Space)
  13. ;
  14. ;c33 - .5,.5,.5,.5
  15. ;
  16. ;Input
  17. ;
  18. ;V0 - Position
  19. ;V7 - Texture 
  20. ;V3 - Normal
  21. ;V8 - Tangnet
  22.  
  23. ;Take normal and binormal into worldspace first
  24. m3x3 r7,v8,c0
  25. m3x3 r8,v3,c0
  26.  
  27. ;Cross product, orientation flip here
  28. ;content dependent
  29. mul r0,r7.zxyw,-r8.yzxw;
  30. mad r5,r7.yzxw,-r8.zxyw,-r0;
  31.  
  32. ;transform the light vector
  33. dp3 r6.x,r7,c12
  34. dp3 r6.y,r5,c12
  35. dp3 r6.z,r8,c12
  36.  
  37. ;bias around 128
  38. add r6.xyz,-r6.xyz,c32
  39.  
  40. ;this is also our texture coordinate
  41. ;on our basis
  42. mul oT1.xy,r6.xy,c33
  43.  
  44. ;transform into projection space
  45. m4x4 oPos,v0,c8
  46. mov oT0.xy,v7
  47.  
  48.  
  49.  
  50.  
  51.  
  52.